<div class="navbar navbar-inverse navbar-fixed-top">
    <div class="navbar-inner">
        <div class="container">
            <div class="nav"><img src="{{ asset('images/logo_photo_detail.png') }}"></div>
            {% block logo %}
                {#<img src="{{ asset('images/logo_photo_detail.png') }}">#}{#<span class="logo-leyend">EL PRIMER BANCO DE IMÁGENES 100% LOCAL</span>#}
                {% set brand_path = (admingenerator_config('dashboard_welcome_path') is not null) ? path(admingenerator_config('dashboard_welcome_path')) : '#' %}
                <a class="brand" href="{{ brand_path }}">{% block brand_text %}{{ 'dashboard.brand'|trans({}, 'Admingenerator') }}{% endblock %}</a>
            {% endblock %}
            <div class="nav-collapse collapse">
                {% block profile %}
                    <ul id="profile-nav" class="nav pull-right profile">
                        <li><p class="navbar-text">{{ 'profile.welcome'|trans({'%username%': app.user ? app.user : 'anonymous'}, 'Admingenerator')|raw }}</p></li>
                        {% if app.user %}
                            {% if admingenerator_config('logout_path') is not null %}
                                <li class="btn-group">
                                    {% if admingenerator_config('exit_path') is not null and is_granted('ROLE_PREVIOUS_ADMIN') %}
                                        <button id="button-exit" class="btn btn-small btn-success" title="{{ 'profile.exit'|trans({}, 'Admingenerator') }}">
                                            <i class="icon-level-down icon-rotate-90"></i>
                                        </button>
                                    {% endif %}
                                    <button id="button-logout" class="btn btn-small btn-profile" title="{{ 'profile.logout'|trans({}, 'Admingenerator') }}">
                                        <i class="icon-off icon-white"></i>
                                    </button>
                                </li>
                            {% endif %}
                        {% else %}
                            {% if admingenerator_config('login_path') is not null %}
                                <li class="btn-group">
                                    <button id="button-login" class="btn btn-small btn-profile" title="{{ 'profile.login'|trans({}, 'Admingenerator') }}">
                                        <i class="icon-user icon-white"></i>
                                    </button>
                                </li>
                            {% endif %}
                        {% endif %}
                    </ul>
                {% endblock %}
                {% block menu %}{{ knp_menu_render('SSystemsBackendBundle:DefaultMenuBuilder:adminMenu') }}{% endblock %}
            </div><!--/.nav-collapse -->
        </div><!--/.container -->
    </div><!--/.navbar-inner -->
</div><!--/.navbar -->

{% block login_script_block %}
    <script type="text/javascript">
        $(document).ready(function(){
            {% if admingenerator_config('login_path') is not null %}
            $('#button-login').click(function(){
                document.location = "{{ path(admingenerator_config('login_path')) }}";
            });
            {% endif %}

            {% if admingenerator_config('exit_path') is not null %}
            $('#button-exit').click(function(){
                document.location = "{{ path(admingenerator_config('exit_path')) ~ '?_switch_user=_exit' }}";
            });
            {% endif %}

            {% if admingenerator_config('logout_path') is not null %}
            $('#button-logout').click(function(){
                document.location = "{{ path(admingenerator_config('logout_path')) }}";
            });
            {% endif %}
        });
    </script>
{% endblock %}
